package com.yunkeji.dao.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunkeji.common.core.mapper.BaseMapperPlus;
import com.yunkeji.dao.domain.CallVoiceCheck;
import com.yunkeji.dao.vo.CallVoiceCheckVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 通话话单Mapper接口
 *
 * @author 老张
 * @date 2024-05-27
 */
public interface CallVoiceCheckMapper
    extends BaseMapperPlus<CallVoiceCheckMapper, CallVoiceCheck, CallVoiceCheckVo> {

    @Select("<script>" +
        "SELECT  " +
        "c.*,  " +
        "u.sex as callSex," +
        "u2.sex as answerSex    " +
        "FROM  " +
        "ykj_call_voice_check c  " +
        "LEFT JOIN ykj_app_user u ON c.call_platform_id = u.platform_id " +
        "LEFT JOIN ykj_app_user u2 ON c.answer_platform_id = u2.platform_id " +
        "where 1=1 " +
        "<if test='callPlatformId!=null'>" +
        "and c.call_platform_id = #{callPlatformId} " +
        "</if>" +
        "<if test='answerPlatformId!=null'>" +
        "and c.answer_platform_id = #{answerPlatformId} " +
        "</if>" +
        "<if test='ucid!=null'>" +
        "and c.ucid = #{ucid} " +
        "</if>" +
        "<if test='status!=null'>" +
        "and c.status = #{status} " +
        "</if>" +
        "order by c.create_time desc " +
        "</script>")
    Page<CallVoiceCheckVo> selectListPage(@Param("callPlatformId") Long callPlatformId,
                                          @Param("answerPlatformId") Long answerPlatformId,
                                          @Param("ucid") String ucid,
                                          @Param("status") Integer status,
                                          @Param("Page") Page<CallVoiceCheck> Page);

}
